package com.ibiaoke.boss.controller;

import com.ibiaoke.common.base.BaseController;
import com.ibiaoke.common.response.Res;

import com.ibiaoke.customer.entity.Customer;
import com.ibiaoke.order.service.OrderCouponShareService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by huhaichao on 2017/5/25.
 */
@Controller
public class OrderCouponShareController extends BaseController{
    @Autowired
    private OrderCouponShareService orderCouponShareService;
    @RequestMapping("shareOrderCoupon")
    @ResponseBody
    public Res shareOrderCoupon (Integer orderId) {
        Customer customer = getLoginUser();
        orderCouponShareService.shareOrderCoupon(customer.getCustomerId(),orderId);
        return Res.create();
    }

    @RequestMapping("receiveOrderShareCoupon")
    @ResponseBody
    public Res receiveOrderShareCoupon(Integer orderId) {
        Customer customer = getLoginUser();
        return orderCouponShareService.receiveOrderShareCoupon(customer.getCustomerId(),orderId);
    }
}
